package geralNotaFiscal;

import org.nakedobjects.extended.Cardinality;
import org.nakedobjects.extended.CompositeAssociation;
import org.nakedobjects.extended.Entity;
import org.nakedobjects.extended.Way;
import org.nakedobjects.extended.CompositeAssociation.CompositeType;
import org.nakedobjects.object.AbstractNakedObject;
import org.nakedobjects.object.collection.ExtendedInternalCollection;

@Entity
public class NotaFiscal extends AbstractNakedObject{
		
	@CompositeAssociation(
			cardinality = Cardinality.ManyToOne, 
			compositeType = CompositeType.Physical, 
			fieldRelatedName = "notasfiscais", 
			relatedWith = Endereco.class, 
			way = Way.TwoWay 
			)
	private Endereco endereco ;
	
	public Endereco getEndereco() {
		resolve(endereco);
		return endereco;
	}
	
	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
		objectChanged();
	}
	
	private final ExtendedInternalCollection itenspedidos = new ExtendedInternalCollection(
			"Itenspedidos", ItemPedido.class, this);
	

	public ExtendedInternalCollection getItenspedidos() {
		return itenspedidos;
	}

	
}
